package com.project.communitymanagement.common;

import lombok.Data;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * @ProjectName: hotelNew
 * @Package: com.setup.mysql.common
 * @ClassName: Request
 * @Author: "XGP"
 * @Description:
 * @Date: 2021/09/13 11:30
 * @Version: 1.0
 */
@Data
public class Request<T> {
    private T data;
    public static boolean isRequest(Request r){
        if(r==null || r.getData()==null)
            return false;
        if(r.getData() instanceof List && ((List<?>) r.getData()).size()==0)
            return false;
        if(r.getData().getClass().getName().equals("java.lang.String") && !StringUtils.hasText(r.getData().toString().trim()))
            return false;
        return true;
    }
}
